#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int cmp(const void* n1, const void* n2) { return *(int*)n1 - *(int*)n2; }
int main()
{
    char s[100] = { 0 };
    int arr[6] = { 0 };
    for (int i = 0; i < 6; i++)
    {
        scanf("%s", s);
        /*if (i == 5)
        {
            s[strlen(s) - 1] = 0;
        }*/
        if (!strcmp(s, "one") || !strcmp(s, "a") || !strcmp(s, "first") || !strcmp(s, "another"))  arr[i] = 1;
        if (!strcmp(s, "two") || !strcmp(s, "both") || !strcmp(s, "second")) arr[i] = 4;
        if (!strcmp(s, "three") || !strcmp(s, "third")) arr[i] = 9;
        if (!strcmp(s, "four")) arr[i] = 16;
        if (!strcmp(s, "five")) arr[i] = 25;
        if (!strcmp(s, "six")) arr[i] = 36;
        if (!strcmp(s, "seven")) arr[i] = 49;
        if (!strcmp(s, "eight"))  arr[i] = 64;
        if (!strcmp(s, "nine"))  arr[i] = 81;
        if (!strcmp(s, "eleven")) arr[i] = 21;
        if (!strcmp(s, "twelve")) arr[i] = 44;
        if (!strcmp(s, "thirteen"))  arr[i] = 69;
        if (!strcmp(s, "fourteen"))  arr[i] = 96;
        if (!strcmp(s, "fifteen"))  arr[i] = 25;
        if (!strcmp(s, "sixteen")) arr[i] = 56;
        if (!strcmp(s, "seventeen"))  arr[i] = 89;
        if (!strcmp(s, "eightteen"))  arr[i] = 24;
        if (!strcmp(s, "nineteen")) arr[i] = 61;
    }
    //int ret[6] = {0};
    int j = 0;
    /*for (; j < 6; j++)
    {
        int min = 100;
        for (int i = 0; i < 6; i++)
        {
            if (min > arr[i])min = arr[i];
        }
        if (min == 100)break;
        ret[j] = min;
    }*/
    qsort(arr, 6, sizeof(int), cmp);
    char i[100] = { 0 };
    /*if (j == 0)printf("0\n");
    if (j == 1)
    {
        sprintf(i, "%d", ret[0]);
        printf("%s", i);
    }
    if (j == 2)
    {
        sprintf(i, "%d%d", ret[0],ret[1]);
        printf("%s", i);
    }
    if (j == 3)
    {
        sprintf(i, "%d%d%d", ret[0],ret[1],ret[2]);
        printf("%s", i);
    }
    if (j == 4)
    {
        sprintf(i, "%d%d%d%d", ret[0], ret[1], ret[2],ret[3]);
        printf("%s", i);
    }
    if (j == 5)
    {
        sprintf(i, "%d%d%d%d%d", ret[0], ret[1], ret[2],ret[3],ret[4]);
        printf("%s", i);
    }
    if (j == 6)
    {*/
    //sprintf(i, "%d%d%d%d%d%d", ret[0], ret[1], ret[2], ret[3], ret[4],ret[5]);
    sprintf(i, "%02d%02d%02d%02d%02d%02d", arr[0], arr[1], arr[2], arr[3], arr[4], arr[5]);
    while (i[0] == '0' && i[1])
    {
        int j = 0;
        while (i[j])
        {
            i[j] = i[j + 1];
            j++;
        }
    }
    printf("%s", i);
    //}
    return 0;
}